package com.sun.relationship.twoway;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "DEMO_MEMBER_2WAY")
public class Member2Way implements Serializable {

	private static final long serialVersionUID = 1051862209929606861L;

	private String id;
	private String name;
	private Project2Way project2Way;
	
	public Member2Way() {
	}

	public Member2Way(String name) {
		this.name = name;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "bizGenerator")
	@GenericGenerator(name = "bizGenerator", strategy = "uuid")
	@Column(length = 32)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@ManyToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="PROJECT_ID")
	public Project2Way getProject2Way() {
		return project2Way;
	}

	public void setProject2Way(Project2Way project2Way) {
		this.project2Way = project2Way;
	}

	@Override
	public String toString() {
		return "Member2Way [id=" + id + ", name=" + name + ", project2Way=" + project2Way + "]";
	}
}
